"""
HTTP client models and exceptions following SOLID principles.
"""

from typing import Dict, Any, Optional
from pydantic import BaseModel


class HTTPRequest(BaseModel):
    """HTTP request model."""
    
    method: str
    url: str
    headers: Optional[Dict[str, str]] = None
    params: Optional[Dict[str, Any]] = None
    json: Optional[Dict[str, Any]] = None
    data: Optional[Any] = None
    timeout: Optional[float] = 30.0


class HTTPResponse(BaseModel):
    """HTTP response model."""
    
    status_code: int
    headers: Dict[str, str]
    content: bytes
    text: str
    json_data: Optional[Dict[str, Any]] = None
    url: str
    elapsed: float


class HTTPClientError(Exception):
    """Base HTTP client exception."""
    
    def __init__(self, message: str, response: Optional[HTTPResponse] = None):
        super().__init__(message)
        self.response = response


class HTTPTimeoutError(HTTPClientError):
    """HTTP timeout exception."""
    pass


class HTTPConnectionError(HTTPClientError):
    """HTTP connection exception."""
    pass